﻿using System;
using System.Collections;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data;

namespace WindowsFormsApplication1
{
    public class Haron
    {
        public delegate void Ready(List<string> output);
        public event Ready onReady;
        protected List<string> lst = new List<string>();
        protected string[] classes = new string[]{"string","int","long","List","ArrayList","File","double","float","bool"};

        /// <summary>
        /// Метод обработчика информации из файла
        /// </summary>
        /// <param name="input"></param>
        /// <param name="h"></param>
        /// <param name="mod"></param>
        public void Parser(string input, bool h)
        {
            string[] readFile;
            readFile = File.ReadAllLines(input, Encoding.Default);
            for (int i = 0; i < readFile.LongLength; i++)
                for (int j = 0; j < classes.Length; j++)
                    if (readFile.Contains("public " + classes[j]))
                        lst.Add(readFile[i]);
            
            onReady(lst);
        }

        /// <summary>
        /// Метод обработчика текстовой информации
        /// </summary>
        /// <param name="input"></param>
        /// <param name="mod"></param>
        public void Parser(string input)
        {
            string readTextBox = input;
            string str;
            for (int j = 0; j < classes.Length; j++)
            {
                str = "public " + classes[j];
                if (readTextBox.Contains(str))
                {
                    lst.Add("public " + classes[j]);
                }
            }
            onReady(lst);
        }
    }
}
